package com.lingyuan.cart.web;

import com.lingyuan.cart.domain.CartEntity;
import com.lingyuan.cart.service.CartService;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.List;

/**
 * @ClassName：CartWebController
 * @Author: LeiHao
 * @Date: 2024/9/20 15:33
 * @Description: 购物车页面控制层
 */
@Controller
public class CartWebController {

    @Autowired
    private CartService cartService;
    @GetMapping("cart.html")
    public String cart(Model model, String token)
    {
        List<CartEntity> cartEntityList = cartService.getCartEntityList();
        model.addAttribute("cartEntityList",cartEntityList);
        model.addAttribute("token",token);
        return "cart";
    }
}
